<extend name="Base:base" />
<block name="style">
<style type="text/css">
.buttonA{margin:20px 30px 0 0;}
.tableC td{color:#555;}
</style>
</block>
<block name="mainCont">
	<div id="uploadContainer" style="display:none;">
		<div id="queue"></div>
		<input id="file_upload" name="file_upload" type="file" multiple>
	</div>

    <div id="div_view_info" align="center">
    	<table class="tableC" align="center" border="0" cellpadding="0" cellspacing="0">
        	<tr><th colspan="2">Bug详细</th></tr>
    		<tr><td width="60px"><label>简介</label></td><td><b>{$bug_title}</b></td></tr>
            <tr>
            	<td><label>版本</label></td>
            	<td>{$bug_version}</td></tr>
        	<tr><td><label>负责人</label></td>
        		<td>{$bug_ownerid|getNickName}</td></tr>
        	<tr>
            	<td><label>模块</label></td>
            	<td>{$Think.config.BUG_MODULE.$bug_module}</td></tr>
            <tr>
            	<td><label>平台</label></td>
            	<td>{$Think.config.BUG_PLATFORM.$bug_platform}</td></tr>
       		<tr>
       			<td><label>级别</label></td>
       			<td>{$Think.config.BUG_LEVEL.$bug_level}</td></tr>
       		<tr>
       			<td><label>状态</label></td>
       			<td>{$Think.config.BUG_STATUS.$bug_status}</td></tr>
       		<tr><td><label>详细</label></td><td valign="top">{$bug_content}</td></tr>
       		<tr><td></td><td><div id="div_bug_button"><input type="button" value="变更" id="buttonA" class="buttonA">
       		<input type="button" value="删除" id="buttonB"class="buttonA"></td></div></td></tr>
        </table>
    </div>

    <div id="div_edit_info" align="center" style="display:none">
    	<table class="tableC" align="center" border="0" cellpadding="0" cellspacing="0">
        	<form action="changeBug" method="post" id="form_change_bug"><input type="hidden" name="bugid" value="{$bug_bugid}">
        	<tr><th colspan="2">Bug详细</th></tr>
    		<tr><td width="60px"><label>简介</label></td><td>
            		<input type="text" name="title" value="{$bug_title}" class="textA">
                </td></tr>
            <tr>
            	<td><label>版本</label></td><td>
                	<input type="text" name="version" value="{$bug_version}" class="textD">
                </td></tr>
        	<tr><td><label>负责人</label></td><td>
            		<select id="input_ownerid" name="ownerid" class="selectA">
        				<foreach name="Think.session.bw_AllUser" item="user">
                			<if condition="($key eq $bug_ownerid)"><option value="{$key}" selected="selected">{$user}</option>
                    		<else /><option value="{$key}">{$user}</option>
                    		</if>
        				</foreach>
            		</select>
                </td></tr>
        	<tr>
            	<td><label>模块</label></td><td>
                	<select id="input_module" name="module" class="selectA">
            			<foreach name="Think.config.BUG_MODULE" item="module">
            				<if condition="($key eq $bug_module)"><option value="{$key}" selected>{$module}</option>
                    		<else /><option value="{$key}">{$module}</option>
                    		</if>
            			</foreach>
            		</select>
                </td></tr> 
            <tr>
            	<td><label>平台</label></td><td>
                	<select id="input_platform" name="platform" class="selectA">
            			<foreach name="Think.config.BUG_PLATFORM" item="pt">
            				<if condition="($key eq $bug_platform)"><option value="{$key}" selected>{$pt}</option>
                    		<else /><option value="{$key}">{$pt}</option>
                    		</if>
            			</foreach>
            		</select>
                </td></tr>
       		<tr>
       			<td><label>级别</label></td><td>
                	<select id="input_level" name="level" class="selectA">
       					<foreach name="Think.config.BUG_LEVEL" item="level">
                			<if condition="($key eq $bug_level)"><option value="{$key}" selected>{$level}</option>
                    		<else /><option value="{$key}">{$level}</option>
       						</if>
       					</foreach>
       				</select>
                </td></tr>
       		<tr>
       			<td><label>状态</label></td><td>
                	<select id="input_status" name="status" class="selectA">
       					<foreach name="Think.config.BUG_STATUS" item="status">
                			<if condition="($key eq $bug_status)"><option value="{$key}" selected>{$status}</option>
                    		<else /><option value="{$key}">{$status}</option>
                    		</if>
       					</foreach>
       				</select>
                </td></tr>
       		<tr>
            	<td><label>详细</label></td><td valign="top">
            		<textarea name="content" id="textArea">{$bug_content}</textarea>
                </td></tr>
       		<tr><td></td><td>
            		<input type="button" value="提交" id="buttonA" class="buttonA">
       				<input type="button" value="还原" id="buttonB"class="buttonA">
                </td></tr>
        </table>
    </div>
    
</block>

<block name="script">
<link href="__ROOT__/Public/WangEditor/css/wangEditor-1.3.12.css" rel="stylesheet" type="text/css">
<script src="__ROOT__/Public/WangEditor/js/wangEditor-1.3.12.min.js"></script>
<link rel="stylesheet" type="text/css" href="__ROOT__/Public/Uploadify/uploadify.css">
<script src="__ROOT__/Public/Uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<script language="javascript">
var textArea, upLoader;

//wangEditor插件使用
textArea	= $("#textArea").wangEditor({uploadImgComponent:$('#uploadContainer')});

//uploader插件使用
upLoader	= $('#file_upload').uploadify({
					'swf'      : '__PUBLIC__/Uploadify/uploadify.swf',
					'uploader' : '../Index/upLoadFile',	//'{:U("Index/upLoadFile")}',   //上传的方法
					'buttonText' : '浏览图片',
					'onUploadSuccess' : function(file, data, response) {
						var imgSrc	= '__PUBLIC__/Image/Bug/'+data;
						textArea.html(textArea.html()+"<img width='200' src="+imgSrc+">");
					}
				});
//变更Bug
$(".buttonA").click(function(){
	switch($(this).val()){
		case "变更":
			$("#div_edit_info").css("display","block");
			$("#div_view_info").css("display","none");
		break;
		
		case "还原":
			$("#div_view_info").css("display","block");
			$("#div_edit_info").css("display","none");
		break;
		
		case "提交":
			$("#form_change_bug").submit();
		break;
		
		case "删除":
			window.open("../Bug/delBug?bugid={$bug_bugid}","_self");
		break;
	}
});


</script>
</block>